//
// Created by none98 on 2021/9/14.
//

#include <spdlog/spdlog.h>
#include "TimeStamp.h"
#include "sys/time.h"

TimeStamp TimeStamp::NowTime() {
    TimeStamp t;
    struct timeval time;
    struct timezone tzone;
    if(gettimeofday(&time,&tzone)<0) {
        spdlog::error("timerqueue get time error:{}",strerror(errno));
        return t;
    }
    t.seconds = static_cast<long>(time.tv_sec);
    t.microSeconds = static_cast<int>(time.tv_usec);
    return t;
}
